package com.atguigu.gmall.juc.thread;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * @author 陈昆昆
 * @version 1.0
 * @date 2020/5/28 10:41
 */
public class ShutdownNow {
    public static void main(String[] args) throws InterruptedException {
        ExecutorService executorService = Executors.newFixedThreadPool(4);
        for (int i = 0; i < 1000; i++) {
            executorService.execute(new Shut());
        }
        Thread.sleep(1500L);
        System.out.println(executorService.isShutdown());
        executorService.shutdown();
        System.out.println(executorService.isShutdown());
//        executorService.execute(new Shut());
    }
}

class Shut implements Runnable{

    public void run() {
        try {
            Thread.sleep(500);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        System.out.println(Thread.currentThread().getName()+"---->"+"正在执行");
//        System.out.println(Thread.currentThread().getName()+"---->"+"被中断了");
    }
}